<?php
$compchecked = '';
$trainerResponse = MakeQuery::trainerResponseRate($model->users_id, $model->backend_user_id);
if (!empty($compareIds)) {
    $display = '';
    if (in_array($model->id . "@course", $compareIds)) {
        $compchecked = 'checked="checked"';
    }
} else {
    $display = 'none';
}
$this->renderPartial('/compare/_view', array('compareIds' => $compareIds, 'classmodel' => $model, 'display' => $display));
?>
<div class="featureBox">
    <div class="container">
        <div class="row">
            <div class="span12">            	
                <ul class="breadcrumb">
                    <li class="previous"><a href="<?php echo SITE_URL; ?>">Home /</a></li>
                    <li><a href="javascript:void(0)"><?php echo $model->course_titile; ?></a></li>
                </ul>                    
            </div>
            <div class="span6"> 
                <!--Trainer Overview Section-->           	
                <div class="featureImg drag-desired">
                    <?php
                    if (ClassImage::getCoursesPrimaryImage($model->id) <> "") {
                        echo '<div class="product"><img src="' . baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . 'details-image/' . ClassImage::getCoursesPrimaryImage($model->id) . '"  alt="' . $model->course_titile . '" id="' . $model->id . '"></div>';
                    } else {
                        echo '<div class="product"><img src="' . baseUrl() . '../../' . getUploadDir() . '/no-class-image.jpg" height="335" width="460"  alt="' . $model->course_titile . '" id="' . $model->id . '"></div>';
                    }
                    ?>
                    <div class="offTag">
                        <p class="font-opensansbd txtUpCase txtfff remmarginB"><?php echo $discount; ?> </p>
                    </div>	
                    <div class="description">
                        <div class="col col1">    
                            <?php
                            $this->widget('CStarRating', array(
                                'name' => 'FunLearning[fun]',
                                'value' => ($funLearing != '') ? $funLearing->fun / 20 : '',
                                'minRating' => 0.5,
                                'readOnly' => TRUE,
                                'ratingStepSize' => 0.5,
                                'maxRating' => 5,
                            ));
                            ?>                    	
                            <p class="fnt-size12 txtfff remmarginB">Fun Quotient</p>
                        </div>
                        <div class="col col2">
                            <?php
                            $this->widget('CStarRating', array(
                                'name' => 'FunLearning[learn]',
                                'value' => ($funLearing != '') ? $funLearing->learn / 20 : '',
                                'minRating' => 0.5,
                                'readOnly' => TRUE,
                                'ratingStepSize' => 0.5,
                                'maxRating' => 5,
                            ));
                            ?>
                            <p class="fnt-size12 txtfff remmarginB">Learn Quotient</p>
                        </div>
                        <div class="col col3">
                            <p class="txtgreen font-opensansbd remmarginB"><?php echo (!empty($trainerResponse) ? $trainerResponse . '%' : TRAINER_RESPONSE_RATE); ?></p>
                            <p class="fnt-size12 txtfff remmarginB">Response Rate</p>
                        </div>
                        <div class="col col4">
                            <p class="txtgreen font-opensansbd remmarginB"><?php echo ($model->difficulty_type == '1' ? 'Beginner' : ($model->difficulty_type == '2' ? 'Intermediate' : ($model->difficulty_type == '3' ? 'Advance' : 'No data'))); ?></p>
                            <p class="fnt-size12 txtfff remmarginB">Level</p>
                        </div>
                    </div>		
                </div>
                <!--End Trainer Overview Section-->
            </div>
            <div class="span6">
                <!--Trainer Detail Section-->
                <div class="detailBox">
                    <p class="font-opensansbd fnt-size12">By <span class="txtgreen"><?php echo $userDetails->first_name . '  ' . $userDetails->last_name; ?></span></p>
                    <h4 class="txt676 fnt-size20 addpaddingB10"><?php echo $model->course_titile; ?></h4>
                    <div class="height1px borBgren addmarginB10"></div>
                    <p class="fnt-size18">
                        <?php echo $priceRange; ?>
                    </p>
                    <div class="height1px borBgren addmarginB10"></div>
                    <div class="addmarginB10"><input type="checkbox" <?php echo $compchecked; ?>  id="<?php echo $model->id; ?>" class="comareclass" value="<?php echo $model->id; ?>"><label>Compare Course</label></div>
                    <div class="height1px borBgren addmarginB30"></div>
                    <a href="javascript:void(0);" class="btn-green twoBtn" id="mybook"><?php echo $booknow; ?></a>
                    <?php echo CHtml::link('Recommend to a friend', $this->createAbsoluteUrl('RecommendToUser/create/', array('id' => $model->id, 'type' => 'courses')), array('class' => 'btn-blue twoBtn')); ?>
                    <?php //echo "<a href='' class='btn-green'>Gift A Class</a>"; ?>
                </div>
				
                <!--End Trainer Detail Section-->
            </div>
        </div>
    </div>
</div>
<a id="venueBatchscroll"></a>
<section class="contentCntr whiteBg noRadius">
    <div class="container">
        <div class="row">
            <div class="span8"> 
                <!--Content Area-->
                <div class="descriptionArea">           	
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active"><a href="#information" data-toggle="tab">Information</a></li>
                        <li><a href="#trainer" data-toggle="tab">Trainer</a></li>
                        <li><a href="#reviews" data-toggle="tab">Reviews</a></li>
                        <li><a href="#pictures" data-toggle="tab">Pictures &amp; Videos</a></li>
                        <li><a href="#venueBatch" id="myvbatch" data-toggle="tab">Venue &amp; Batch Details</a></li>
                    </ul>

                    <div id="descriptionTabs" class="tab-content">
                        <div class="tab-pane active" id="information">
                            <h2 class="remmarginT">Course Description</h2>
                            <?php echo $model->course_description; ?>
                            <h2>Course Outcome</h2>
                            <?php echo $model->course_outcome; ?>
                            <h2>Prerequisities</h2>
                            <?php echo $model->course_prerequisites; ?>

                        </div>

                        <?php /* here is the code of trainer details start */ ?>
                        <div class="tab-pane" id="trainer">
                            <?php /* ---------render page userPage for userDetails all  review start ---------------- */ ?>
                            <?php $this->renderPartial('/users/userDetails', array('userDetails' => $userDetails, 'imagePath' => $imagePath, 'classmodel' => $model, 'userType' => $userType)); ?>
                            <?php /* ---------render page userPage for userDetails end---------------- */ ?>
                        </div>
                        <?php /* here is the code of trainer details start */ ?>

                        <div class="tab-pane" id="reviews">
                            <?php
                            $reviewdetails = Reviews::getAllReview('courses_id', $model->id);
                            if (!empty($reviewdetails)) {
                                foreach ($reviewdetails as $key => $value) {
                                    $profile = Users::getFrontEndUser($value->users_id);
                                    ?>
                                    <div class="padding20px">
                                        <div class="reviewBoxText">
                                            <?php
                                            if ($profile->photo <> "") {
                                                $imgsrc = baseUrl() . '../../' . getUploadDir() . $profile->user_id . '/profile/minithumb/' . $profile->photo;
                                            } else {
                                                $imgsrc = baseUrl() . '../../upload/default-mini.png';
                                            }
                                            ?>
                                            <img src="<?php echo $imgsrc; ?>" title="<?php echo $profile->first_name; ?>" alt="<?php echo $profile->first_name; ?>" />
                                        </div>
                                        <div class="reviewBoxTextcol2"><?php echo $profile->first_name . '   ' . $profile->last_name; ?><br/>
                                            <?php echo $value->reviews_text; ?><br/><br/>
                                            <?php echo $value->create_time; ?></div>
                                    </div>
                                    <div class="clear"></div>
                                    <?php
                                }
                            }
                            ?>
                        </div>

                        <?php /* here is the code of Classses images start */ ?>
                        <div class="tab-pane" id="pictures">
                            <div style="margin: 92px 0px 0px 0px;">                                
                                <?php
                                $classWithImage = Courses::getCourseWithImage($model->id);
                                if (!empty($classWithImage)) {
                                    $i = 1;
                                    ?>
                                    <div id="slider-fixed-banner" class="carousel slide">
                                        <div class="carousel-inner"><?php foreach ($classWithImage as $value) { ?>
                                                <div class="<?php echo ($i == 1) ? 'active' : ''; ?> item">
                                                    <?php echo '<img src="' . baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . 'slider-image/' . $value['photo'] . '"  alt="">'; ?>
                                                </div>
                                                <?php
                                                $i++;
                                            }
                                            ?>
                                        </div>
                                        <a class="left carousel-control" href="#slider-fixed-banner" data-slide="prev">&lsaquo;</a>
                                        <a class="right carousel-control" href="#slider-fixed-banner" data-slide="next">&rsaquo;</a>
                                    </div><?php
                                    } else {
                                        echo '<img src="' . baseUrl() . '../../' . getUploadDir() . '/no-class-image.jpg"   alt="class" id="classcourse">';
                                    }
                                        ?> 
                            </div>
                        </div>  
                        <?php /* here is the code of Classses images end */ ?>
                        <div class="tab-pane" id="venueBatch">
                            <?php /* ---------render page classBatch for _venueBatchDetails all  review start ---------------- */ ?>
                            <?php $this->renderPartial('/courseBatche/_venueBatchDetails', array('model' => $model)); ?>
                            <?php /* ---------render page classBatch for _venueBatchDetails end---------------- */ ?>
                        </div>
                    </div>				
                </div>    
                <!--End Of Content Area-->    
            </div>
            <div class="span4">            	
                <!--Book Now-->
                <div class="bookNowBox radius4px">
                    <div class="formElements">
                        <?php $this->renderPartial('/makeQuery/_form', array('type' => 'courses', 'model' => $makeQueryModel, 'timingMakequeryModel' => $timingMakequeryModel, 'classModel' => $model)); ?>
                    </div>
                </div>
                <!--End of Book Now-->
            </div>     
        </div>
    </div>    
</section>



<section class="contentCntr">
    <div class="container">
        <div class="row">
            <div class="span5">
                <!--Review Box-->
                <div class="reviewBox">  
                    <div id="reviewDiv">              	
                        <h4 class="txttTransformNorml addpaddingB20">Reviews<span class="rbutton"> <a class="carousel-control left" href="#reviewCarousel" data-slide="prev"><img src="<?php echo ThemePath(); ?>/images/slide-left.png" /></a><a class="carousel-control right" href="#reviewCarousel" data-slide="next"><img src="<?php echo ThemePath(); ?>/images/slide-right.png" /></a></span></h4>
                        <?php /* ---------render page reviewpage for view all  review start ---------------- */ ?>
                        <?php $this->renderPartial('/reviews/_viewReviewCourse', array('model' => $model)); ?>
                        <?php /* ---------render page reviewpage end---------------- */ ?>

                    </div>
                    <div id="reviewEntryBox" style="display:none;">
                        <h4 class="txttTransformNorml">Add Review</h4>
                        <form>
                            <fieldset>
                                <?php /* ---------render page reviewpage for write review start ---------------- */ ?>
                                <?php $this->renderPartial('/reviews/_form', array('model' => $model, 'classcoursetype' => 'courses')); ?>
                                <?php /* ---------render page reviewpage end---------------- */ ?>
                            </fieldset>
                        </form>
                    </div>
                </div>
                <!--End of Review Box-->    
            </div>
            <div class="span7">
                <!--Query Box--> 
                <div class="ratingBox addmarginB20">                        
                    <h4 class="txttTransformNorml addpaddingB20">Was the information on the<br>page sufficient?</h4>
                    <div class="padding20px">                       
                        <?php /* here 1=>like and 2=>unlike for status */ ?>
                        <p class="fnt-size14 txtfff">Class description</p>
                        <p class="addmarginB20"><a href="javascript:void(0);" class="sprite thumb-up addmarginR10" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::DESCRIPTION_CLASS_COURSE; ?>,'course',1)"></a><a href="javascript:void(0);" class="sprite thumb-down" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::DESCRIPTION_CLASS_COURSE; ?>,'course',2)"></a></p>
                        <p class="fnt-size14 txtfff">Class Structure</p>
                        <p class="addmarginB20"><a href="javascript:void(0);" class="sprite thumb-up addmarginR10" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::STRUCTURE_CLASS_COURSE; ?>,'course',1)"></a><a href="javascript:void(0);" class="sprite thumb-down" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::STRUCTURE_CLASS_COURSE; ?>,'course',2)"></a></p>
                        <p class="fnt-size14 txtfff">Class Outcome</p>
                        <p><a href="javascript:void(0);" class="sprite thumb-up addmarginR10" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::OUTCOME_CLASS_COURSE; ?>,'course',1)"></a><a href="javascript:void(0);" class="sprite thumb-down" onclick="likeUnlikeClassCourseContent(<?php echo $model->id; ?>,<?php echo SkillConfig::OUTCOME_CLASS_COURSE; ?>,'course',2)"></a></p>
                        <div id="ajaxLoder_<?php echo $model->id; ?>" style="margin: 0 auto;width: 50%;display: none;"><img src="<?php echo ThemePath(); ?>/images/AjaxLoader.gif"></img></div>
                    </div>                    
                </div>
                <?php /* --------- this code comment when will be use admin want change this functionality
                  <div class="reviewBox">

                  <h4 class="txttTransformNorml">Have a query about this class ?<br>Write to Us:</h4>
                  <div class="errorMessage" id="class-course-query-form-formResult" style="margin: 90px 0px 0px 60px;font-size: 25px;color: #fff;display: none;"></div>
                  <div id="AjaxLoader" style="margin: 0 auto;width: 50%;display: none;"><img src="<?php echo ThemePath(); ?>/images/AjaxLoader.gif"></img></div>
                  <?php  ---------render page reviewpage for write Query start ----------------  ?>
                  <?php $this->renderPartial('/classCourseQuery/_classQuery', array('class_course_type' => 'courses', 'course' => $model->id)); ?>


                  </div>   ---------render page reviewpage end---------------- */
                ?>
                <!--End of Query Box-->
            </div>
        </div>
    </div>
</section>

<section class="contentCntr whiteBg">
    <div class="container">
        <div class="row">
            <!--Tags Section-->
            <div class="span5">
                <h4 class="font-opensanslt txt999 fnt-size26 txttTransformNorml fnt-weightN addpaddingB10">Tags</h4>
                <div class="tagElement blueBor radius4px">
                    <div class="padding20px">
                        <?php
                        /* --------------------code for write class tag------------------------------------- */
                        if (count($classTag) > 0) {
                            foreach ($classTag as $key => $value) {
                                if (!empty($value)) {
                                    echo '<span class="hastag">#' . $value . '</span>';
                                }
                            }
                        } else {

                            echo "There is no tag.";
                        }
                        ?>
                    </div>
                </div>
            </div>
            <!--End Tags Section-->
            <!--Recommend Section-->
            <div class="span7">
                <h4 class="font-opensanslt txt999 fnt-size26 txttTransformNorml addpaddingB10 fnt-weightN">Reviews and Recommendations</h4>
                <div class="recommendBox">

                    <div class="contents">
                        <div class="floatL">
                            <h4><?php echo (!empty($classtotalCountTrainerate)) ? $classtotalCountTrainerate . '<br>Recommendations' : 'No Recommendations'; ?></h4>
                            <p class="padding10px font-opensansilt fnt-size20 whiteBg inline-block noRadius"><?php echo (!empty($classTrainerRate)) ? $classTrainerRate . '% Positive' : '0% Positive'; ?></p>
                        </div>
                        <img class="floatR" src="<?php echo ThemePath(); ?>/images/recomend-hand.png" />
                    </div>

                </div>
            </div>
            <!--End Recommend Section-->
        </div>
    </div>
</section>
<?php /* Literally Ending tomorrow Slider */ ?>
<?php
$allClassCourseInfo = array();
$classDetails = literalEndingTommorow('', '', '');
$courseDetails = runningCurrentCoursesByUser('', '', ''); //Null parameter means these value $profiles, $userType, $getValue)
$allClassCourseInfo = array_merge($classDetails, $courseDetails);
usort($allClassCourseInfo, 'date_compare');
$validatedata = literalendingtommorowValiadte($allClassCourseInfo);
if (!empty($validatedata)) {
    $this->renderPartial('/classes/literallyEndingtomorrow', array('allClassCourseInfo' => $allClassCourseInfo));
}
?>

<?php /* code for slider People who liked this Literally Ending tomorrow */ ?>
<?php
$likeClassCourse = peoplelikedClassCourse();
if (!empty($likeClassCourse)) {
    $this->renderPartial('/classes/_likeClassCourse');
}
?>



<script type="text/javascript" src="<?php echo ThemePath(); ?>/js/jquery.nicescroll.js"></script>
<script type="text/javascript">
    function likeUnlikeClassCourseContent(classid,type,classcoursetype,status){       
        jQuery.ajax({
            'type': 'POST',
            'url': "<?php echo Yii::app()->createAbsoluteUrl("ClassCourseContentLikeUnlike/savelikeUnlikeClassCourseContent"); ?>",
            'data': "type=" + type + "&classcourseId=" + classid+"&classcoursetype="+classcoursetype+"&status="+status,
            'beforeSend': function(jqXHR, settings) {
                $("#ajaxLoder_" + classid).show();
            },
            'success': function(data) {               
                if (data==1) {    
                    $("#ajaxLoder_" + classid).hide();
                }
            },
            'cache': false
        });
        
    }

    /* This is for add to comare and remove */
    $(document).ready(function(){
        $(".product img").draggable({
            containment: 'document',
            opacity: 0.6,
            revert: 'invalid',
            helper: 'clone',
            zIndex: 100
        });

        $("div.drop-here").droppable({
            drop:
                function(e, ui){
                var param = $(ui.draggable).attr('id');
                if($.browser.msie && $.browser.version=='6.0'){
                    param = $(ui.draggable).attr('style').match(/src=\"([^\"]+)\"/);
                    param = param[1];
                }
                addToCompareList(param);
            }
	
        });

    });

    function addToCompareList(param){
        var compareadded=new Array();
        $.post("<?php echo Yii::app()->createUrl("compare/CompareclassAddClassById"); ?>", 
        {class_course_id: param,classcoursetype: 'course'}, 
        function(resultclass) {
            if(resultclass!=''){
                $("#ajax-loader").hide();
                var comparedata = resultclass.split('#@#');
                var className = comparedata[0];
                var classImg = comparedata[1];
                var check=false;
                var cnt = false;
                $("#cart_comapre").append('<li id="'+param+'"><a href="javascript:void(0);" onclick="RemoveCompareList('+param+',\'course\');" class="sprite cross">&nbsp;</a>'+classImg+'<p class="product">'+className+'</p><input type="hidden" class="compareids" name="class_course_id[]" value="'+param+'" /></li>');
            }
        });
    }
    function RemoveCompareList(classcourseid,class_courseType){
        var classcourseid = classcourseid+"@"+class_courseType;
        $.post("<?php echo Yii::app()->createUrl("compare/RemovecompareclasscourseById"); ?>", 
        {class_course_id: classcourseid,classcoursetype: class_courseType}, 
        function(resultclass) {
            if(resultclass=="no"){
                $("#copareloader").hide();
                $("#comapre_div_id").hide();
            }else{
                $("#copareloader").hide();
                $('#cart_comapre').html(resultclass);
            }
        });
    }

    /*function removeCompare(id) {$("div #" + id).remove();}*/
    /* END */
    jQuery(document).ready(function() {									
        $('.timeFrom').fancyfields();
        $('.timeTo').fancyfields();
        $("#mybook").click(function(event) {
            $("#myvbatch").click();
            $('html, body').animate({scrollTop: $("#venueBatchscroll").offset().top -89},3000);
        });

        $('.venueDetail').fancyfields({
            onSelectChange: function(input, text, val) {
                /*alert("Current input - ID : "+input.attr("id") + " , selected text : " + text + " , value : " + val);*/
                $('#myloader').css('display', 'inline');
                getVenueDetails(input.attr("id"));
                $(".batchDetail").remove();
            }
        });
        /*$("#comareclass_id").fancyfields();*/
										
        $(".comareclass").fancyfields({
            onCheckboxChange: function (input, isChecked, val) {
                $("#copareloader").show();
                /*alert("ID : " + input.attr("id") + " Is checked : " + isChecked);*/
                if(isChecked==true){
                    $.post("<?php echo Yii::app()->createUrl("compare/CompareclassAddClassById"); ?>", {classcoursetype: 'course', class_course_id: input.attr("id")}, function(resultclass) {                 $("#comapre_div_id").show();
                        var comparedata = resultclass.split('#@#');
                        var className = comparedata[0];
                        var classImg = comparedata[1];
                        var countcomare = comparedata[2];
                        if(countcomare>1){
                            $("#cart_comapre").append('<li id="'+input.attr("id")+'"><a href="javascript:void(0);" onclick="RemoveCompareList('+input.attr("id")+',\'course\');" class="sprite cross">&nbsp;</a>'+classImg+'<p class="product">'+className+'</p><input type="hidden" class="compareids" name="class_course_id[]" value="'+input.attr("id")+'@course" /></li>');$("#copareloader").hide();
                        }else{
                            $("#cart_comapre").html('<li id="'+input.attr("id")+'"><a href="javascript:void(0);" onclick="RemoveCompareList('+input.attr("id")+',\'course\');" class="sprite cross">&nbsp;</a>'+classImg+'<p class="product">'+className+'</p><input type="hidden" class="compareids" name="class_course_id[]" value="'+input.attr("id")+'@course" /></li>');$("#copareloader").hide();
                        }
														   
														   

                    });
												
                }else{
												
                    RemoveCompareList(input.attr("id"),"course");
												
                }
												
            }
        });									
										
        $(".customSBDemo").fancyfields({customScrollBar: false});
        $("#demoReset").click(function() {
            $(".flatui").fancyfields("reset");
            $(".customSBDemo").fancyfields("reset");
        });

    });
 
    $(window).ready(function() {
        $("#descriptionTabs").niceScroll({touchbehavior: true, autohidemode: true});
        getVenueDetails('getvanuename');
        $('.batchTime').fancyfields({});
        /*$('.batchSeat').fancyfields({});*/
    });
   
   
    function getVenueDetails(getvanuename) {
        var venueIndex = $("#" + getvanuename).val();
        var classId = $("#classreview_id").val();
        $.post("<?php echo Yii::app()->createUrl("classVenue/SelectedVenue"); ?>", {venueId: venueIndex, user_id: 2}, function(result) {
            if (result != "") {
                $('#myloader').css('display', 'none');
            }
            $("#showVenueDataResult").html(result);
        });
        $.post("<?php echo Yii::app()->createUrl("CourseBatche/SelectBatchDate"); ?>", {venueId: venueIndex, courses_id: classId}, function(result) {
            /* Default Selected Value*/
            /*alert(result);*/
            var btchIdForTime = result.split("@@");
            btchIdForTime = btchIdForTime[1].split("#");
            $("#batchId").val(btchIdForTime[0]);
											
            /*alert(btchIdForTime[0]);*/
											
            $.post("<?php echo Yii::app()->createUrl("CourseBatche/SelectBatchTicket"); ?>", {id: btchIdForTime[0]}, function(result) {
                /*alert(result);*/
                $("#bookSeatId").val(1);
                $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                $('#getbatchseat').find('option').remove().end().append(result).val();
                $("#getbatchseat").addClass("batchSeat");
                $('.batchSeat').fancyfields({
                    onSelectChange: function(input, text, seatval) {
                        $("#bookSeatId").val(seatval);
                        var batchIdVal = $("#batchId").val();
                        $.post("<?php echo Yii::app()->createUrl("CourseBatche/Totalprice"); ?>", {seat: seatval, batchId: batchIdVal}, function(resultprice) {                                              
                            var retultPricedata = resultprice.split("Grand Total Rs. ");
                            $("#totalPrice").html("Total Rs. " + resultprice);
                            $("#totalPriceId").val(retultPricedata[1]);

                        });

                    }
                });
            });
            $.post("<?php echo Yii::app()->createUrl("CourseBatche/Totalprice"); ?>", {seat: 1, batchId: btchIdForTime[0]}, function(resultprice) {
                var totalPriceIdVal = resultprice.split("Grand Total Rs. ");
                $("#totalPrice").html(resultprice);
                $("#totalPriceId").val(totalPriceIdVal[1]);
            });
            /* Default Selected Value*/
            $("#batchval").html('<select id="getbatchdate"></select>');
            $('#getbatchdate').find('option').remove().end().append(result).val();
            $("#getbatchdate").addClass("batchDetail");
            $('.batchDetail').fancyfields({
                onSelectChange: function(input, text, val) {
                    if (val != "") {
                        $.post("<?php echo Yii::app()->createUrl("CourseBatche/SelectBatchTicket"); ?>", {id: val}, function(result) {
                            $("#bookTiming").val(1);
                            $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                            $('#getbatchseat').find('option').remove().end().append('<option name="batchSeat" value="">Choose No. of Tickets</option>' + result).val();
                            $("#getbatchseat").addClass("batchSeat");
                            $("#batchId").val(val);
                            $('.batchSeat').fancyfields({
                                onSelectChange: function(input, text, seatval) {
                                    var batchIdVal = $("#batchId").val();
                                    $.post("<?php echo Yii::app()->createUrl("CourseBatche/Totalprice"); ?>", {seat: seatval, batchId: batchIdVal}, function(resultprice) {
                                        var totalPriceIdVal = resultprice.split("Grand Total Rs. ");
                                        $("#bookSeatId").val(seatval);
                                        $("#totalPrice").html(resultprice);
                                        $("#totalPriceId").val(totalPriceIdVal[1]);
                                    });
                                }
                            });
                        });
                    } else {
                        $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                        $('#getbatchseat').find('option').remove().end().append('<option value="">Choose No. of Tickets</option>').val();
                        $("#getbatchseat").addClass("batchSeat");
                        $('.batchSeat').fancyfields({});
                    }


                }

            });
        });

    }
    function BookNow(VenueId, BatchId) {
        $('#myloader').show(0).delay(5000).hide(0);
        $("#getvanuename").setVal(VenueId);
        $("#getbatchdate").setVal(BatchId);
    }
    function validationBookNow() {
        var checkbookSeat = $("#bookSeatId").val();
        if (checkbookSeat == "") {
            $("div#batchticketval").children().addClass("Errorborder");
            return false;
        } else {
            $("div#batchticketval").children().removeClass("Errorborder");
        }
        return true;
    }
    function NotBeforeToday(date) {
        var now = new Date(); //this gets the current date and time
        if (date.getFullYear() == now.getFullYear() && date.getMonth() == now.getMonth() && date.getDate() > now.getDate())
            return [true];
        if (date.getFullYear() >= now.getFullYear() && date.getMonth() > now.getMonth())
            return [true];
        if (date.getFullYear() > now.getFullYear())
            return [true];
        return [false];
    }
    $("#writeRbtn").click(function() {
        $("#reviewDiv").hide();
        $("#reviewEntryBox").show();
        return false;
    });
    $("#cancelRbtn").click(function() {
        $("#reviewEntryBox").hide();
        $("#reviewDiv").show();
        return false;
    });
    $("#addNewReview").click(function() {
        $("#reviewDiv").hide();
        $("#reviewEntryBox").show();
        return false;
    });
	
</script>
<!--Login Form Popup-->
<div id="loginPopReview" class="pop-out mfp-hide">
    <?php Yii::app()->getModule('user');
    $this->renderPartial('application.modules.user.views.user.loginpopgeneral'); ?>
</div>
<!--End Login Form Popup-->